home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / c++ / iostream.z / iostream
Encoding:
Text File  |  2002-10-03  |  11.7 KB  |  208 lines

  1. IOSTREAM(3C)                                          Last changed: 1-12-99
  2.  
  3.  
  4. NNAAMMEE
  5.      iioossttrreeaamm - Buffering, formatting and input/output
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<iioossttrreeaamm..hh>>
  9.      ccllaassss ssttrreeaammbbuuff ;;
  10.      ccllaassss iiooss ;;
  11.      ccllaassss iissttrreeaamm :: vviirrttuuaall ppuubblliicc iiooss ;;
  12.      ccllaassss oossttrreeaamm :: vviirrttuuaall ppuubblliicc iiooss ;;
  13.      ccllaassss iioossttrreeaamm :: ppuubblliicc iissttrreeaamm,, ppuubblliicc oossttrreeaamm ;;
  14.      ccllaassss iissttrreeaamm__wwiitthhaassssiiggnn :: ppuubblliicc iissttrreeaamm ;;
  15.      ccllaassss oossttrreeaamm__wwiitthhaassssiiggnn :: ppuubblliicc oossttrreeaamm ;;
  16.      ccllaassss iioossttrreeaamm__wwiitthhaassssiiggnn :: ppuubblliicc iioossttrreeaamm ;;
  17.  
  18.      ccllaassss IIoossttrreeaamm__iinniitt ;;
  19.  
  20.      eexxtteerrnn iissttrreeaamm__wwiitthhaassssiiggnn cciinn ;;
  21.      eexxtteerrnn oossttrreeaamm__wwiitthhaassssiiggnn ccoouutt ;;
  22.      eexxtteerrnn oossttrreeaamm__wwiitthhaassssiiggnn cceerrrr ;;
  23.      eexxtteerrnn oossttrreeaamm__wwiitthhaassssiiggnn cclloogg ;;
  24.  
  25.      ##iinncclluuddee <<ffssttrreeaamm..hh>>
  26.      ccllaassss ffiilleebbuuff :: ppuubblliicc ssttrreeaammbbuuff ;;
  27.      ccllaassss ffssttrreeaamm :: ppuubblliicc iioossttrreeaamm ;;
  28.      ccllaassss iiffssttrreeaamm :: ppuubblliicc iissttrreeaamm ;;
  29.      ccllaassss ooffssttrreeaamm :: ppuubblliicc oossttrreeaamm ;;
  30.  
  31.      ##iinncclluuddee <<ssttrrssttrreeaamm..hh>>
  32.      ccllaassss ssttrrssttrreeaammbbuuff :: ppuubblliicc ssttrreeaammbbuuff ;;
  33.      ccllaassss iissttrrssttrreeaamm :: ppuubblliicc iissttrreeaamm ;;
  34.      ccllaassss oossttrrssttrreeaamm :: ppuubblliicc oossttrreeaamm ;;
  35.  
  36.      ##iinncclluuddee <<ssttddiioossttrreeaamm..hh>>
  37.      ccllaassss ssttddiioobbuuff :: ppuubblliicc ssttrreeaammbbuuff ;;
  38.      ccllaassss ssttddiioossttrreeaamm :: ppuubblliicc iiooss ;;
  39.  
  40. IIMMPPLLEEMMEENNTTAATTIIOONN
  41.      IRIX systems
  42.  
  43. DDEESSCCRRIIPPTTIIOONN
  44.      The C++ iostream package declared in iioossttrreeaamm..hh and other header files
  45.      consists primarily of a collection of classes.  Although originally
  46.      intended only to support input/output, the package now supports
  47.      related activities such as incore formatting.  This package is a
  48.      mostly source-compatible extension of the earlier stream I/O package,
  49.      described in _T_h_e _C++ _P_r_o_g_r_a_m_m_i_n_g _L_a_n_g_u_a_g_e by Bjarne Stroustrup.
  50.  
  51.      In the iostream man pages, character refers to a value that can be
  52.      held in either a cchhaarr or uunnssiiggnneedd cchhaarr.  When functions that return an
  53.      iinntt are said to return a character, they return a positive value.
  54.      Usually, such functions can also return EEOOFF (-1) as an error
  55.      indication.  The piece of memory that can hold a character is referred
  56.      to as a byte.  Thus, either a cchhaarr** or an uunnssiiggnneedd cchhaarr** can point to
  57.      an array of bytes.
  58.  
  59.      The iostream package consists of several core classes, which provide
  60.      the basic functionality for I/O conversion and buffering, and several
  61.      specialized classes derived from the core classes.  Both groups of
  62.      classes are described on this man page.
  63.  
  64.    CCoorree CCllaasssseess
  65.      The core of the iostream package is comprised of the following
  66.      classes:
  67.  
  68.      ssttrreeaammbbuuff
  69.           This is the base class for buffers.  It supports insertion (also
  70.           known as ssttoorriinngg or ppuuttttiinngg) and extraction (also known as
  71.           ffeettcchhiinngg or ggeettttiinngg) of characters.  Most members are inlined for
  72.           efficiency.  The public interface of class ssttrreeaammbbuuff is described
  73.           in ssbbuuff..ppuubb(3C) and the protected interface (for derived classes)
  74.           is described in ssbbuuff..pprroott(3C).
  75.  
  76.      iiooss  This class contains state variables that are common to the
  77.           various stream classes, such as error states and formatting
  78.           states.  See iiooss(3C) for more information.
  79.  
  80.      iissttrreeaamm
  81.           This class supports formatted and unformatted conversion from
  82.           sequences of characters fetched from ssttrreeaammbbuuffs.  See iissttrreeaamm(3C)
  83.           for more information.
  84.  
  85.      oossttrreeaamm
  86.           This class supports formatted and unformatted conversion to the
  87.           sequence of characters stored into a ssttrreeaammbbuuff.  See oossttrreeaamm(3C)
  88.           for more information.
  89.  
  90.      iioossttrreeaamm
  91.           This class combines iissttrreeaamm and oossttrreeaamm.  It is intended for
  92.           situations in which bidirectional operations (inserting into and
  93.           extracting from a single sequence of characters) are desired.
  94.           See iiooss(3C) for more information.
  95.  
  96.           istream_withassign
  97.           ostream_withassign
  98.           iostream_withassign
  99.  
  100.      These classes add assignment operators and a constructor with no
  101.      operands to the corresponding class without assignment.  The
  102.      predefined streams (see below) cciinn, ccoouutt, cceerrrr, and cclloogg, are objects
  103.      of these classes.  See iissttrreeaamm(3C), oossttrreeaamm(3C), and iiooss(3C) for more
  104.      information.
  105.  
  106.      IIoossttrreeaamm__iinniitt
  107.           This class is present for technical reasons relating to
  108.           initialization.  It has no public members.  The IIoossttrreeaamm__iinniitt
  109.           constructor initializes the predefined streams (listed below).
  110.           Because an object of this class is declared in the iioossttrreeaamm..hh
  111.           header file, the constructor is called once each time the header
  112.           is included (although the real initialization is only done once),
  113.           and therefore the predefined streams will be initialized before
  114.           they are used.  In some cases, global constructors may need to
  115.           call the IIoossttrreeaamm__iinniitt constructor explicitly to ensure the
  116.           standard streams are initialized before they are used.
  117.  
  118.    PPrreeddeeffiinneedd SSttrreeaammss
  119.      The following streams are predefined:
  120.  
  121.      cciinn  The standard input (file descriptor 0).
  122.  
  123.      ccoouutt The standard output (file descriptor 1).
  124.  
  125.      cceerrrr Standard error (file descriptor 2).  Output through this stream
  126.           is unit-buffered, which means that characters are flushed after
  127.           each inserter operation.  (See the oossttrreeaamm::::oossffxx(()) description in
  128.           the oossttrreeaamm(3C) man page and the iiooss::::uunniittbbuuff description in the
  129.           iiooss(3C) man page.)
  130.  
  131.      cclloogg This stream is also directed to file descriptor 2, but unlike
  132.           cceerrrr, the output is buffered.
  133.  
  134.      cciinn, cceerrrr, and cclloogg are tied to ccoouutt so that any use of these will
  135.      cause ccoouutt to be flushed.
  136.  
  137.      In addition to the core classes previously enumerated, the iostream
  138.      package contains additional classes derived from them and declared in
  139.      other headers.  Programmers may use these or may choose to define
  140.      their own classes derived from the core iostream classes.
  141.  
  142.    CCllaasssseess ddeerriivveedd ffrroomm ssttrreeaammbbuuff
  143.      Classes derived from ssttrreeaammbbuuff define the details of how characters
  144.      are produced or consumed.  Derivation of a class from ssttrreeaammbbuuff (the
  145.      pprrootteecctteedd iinntteerrffaaccee) is discussed in ssbbuuff..pprroott(3C).  The following
  146.      buffer classes are available:
  147.  
  148.      ffiilleebbuuff
  149.           This buffer class supports I/O through file descriptors.  Members
  150.           support opening, closing, and seeking.  Common uses do not
  151.           require the program to manipulate file descriptors.  See
  152.           ffiilleebbuuff(3C).
  153.  
  154.      ssttddiioobbuuff
  155.           This buffer class supports I/O through stdio FFIILLEE structs.  It is
  156.           intended for use when mixing C and C++ code.  New code should
  157.           prefer to use ffiilleebbuuffs.  See ssttddiioobbuuff(3C) for more information.
  158.  
  159.      ssttrrssttrreeaammbbuuff
  160.           This buffer class stores and fetches characters from arrays of
  161.           bytes in memory (i.e., strings).  See ssssbbuuff(3C).
  162.  
  163.    CCllaasssseess ddeerriivveedd ffrroomm iissttrreeaamm,, oossttrreeaamm,, aanndd iioossttrreeaamm
  164.      Classes derived from iissttrreeaamm, oossttrreeaamm, and iioossttrreeaamm specialize the
  165.      core classes for use with particular kinds of ssttrreeaammbbuuffs.  These
  166.      classes are as follows:
  167.  
  168.      iiffssttrreeaamm
  169.      ooffssttrreeaamm
  170.      ffssttrreeaamm
  171.           These classes support formatted I/O to and from files.  They use
  172.           a ffiilleebbuuff to do the I/O.  Common operations (such as opening and
  173.           closing) can be done directly on streams without explicit mention
  174.           of ffiilleebbuuffs.  See ffssttrreeaamm(3C) for more information.
  175.  
  176.      iissttrrssttrreeaamm
  177.      oossttrrssttrreeaamm
  178.      These classes support in core formatting.
  179.           They use a ssttrrssttrreeaammbbuuff.  See ssttrrssttrreeaamm(3C) for more information.
  180.  
  181.      ssttddiioossttrreeaamm
  182.           This class specializes iioossttrreeaamm for stdio FFIILLEEs.  See
  183.           ssttddiioossttrreeaamm..hh for more information.
  184.  
  185. NNOOTTEESS
  186.      Parts of the ssttrreeaammbbuuff class of the old stream package that should
  187.      have been private were public.  Most usage will compile properly, but
  188.      code that depends on details, including classes that were derived from
  189.      ssttrreeaammbbuuffs, will have to be rewritten.
  190.  
  191.      Performance of programs that copy from cciinn to ccoouutt may sometimes be
  192.      improved by breaking the tie between cciinn and ccoouutt and doing explicit
  193.      flushes of ccoouutt.
  194.  
  195.      The header file ssttrreeaamm..hh exists for compatibility with the earlier
  196.      stream package.  It includes iioossttrreeaamm..hh, ssttddiioo..hh, and some other
  197.      headers, and it declares some obsolete functions, enumerations, and
  198.      variables.  Some members of ssttrreeaammbbuuff and iiooss (not discussed in these
  199.      man pages) are present only for backward compatibility with the stream
  200.      package.
  201.  
  202. SSEEEE AALLSSOO
  203.      iiooss(3C), ssbbuuff..ppuubb(3C), ssbbuuff..pprroott(3C), ffiilleebbuuff(3C), ssttddiioobbuuff(3C),
  204.      ssssbbuuff(3C), iissttrreeaamm(3C), oossttrreeaamm(3C), ffssttrreeaamm(3C), ssttrrssttrreeaamm(3C),
  205.      mmaanniipp(3C)
  206.  
  207.      This man page is available only online.
  208.